package com.unitedats.Project.Servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;

import com.unitedats.HR.Entity.HrEmployee;
import com.unitedats.Project.Entity.LookupCountry;
import com.unitedats.Project.Entity.LookupCurrency;
import com.unitedats.Project.Entity.PmProject;
import com.unitedats.common.Servlet.BasicServlet;
import com.unitedats.common.util.DBManager;
import com.unitedats.common.util.WebUtil;

public class ProjectDisplayServlet extends BasicServlet {

	public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		Integer projectId = WebUtil.getParamValueAsInteger(request, "pId", null);
		if (projectId != null) // if in update mode
			request.setAttribute("project", dbm.findById(projectId, PmProject.class));

		request.setAttribute("countryList", dbm.findAll(LookupCountry.class));
		request.setAttribute("currencyList", dbm.findAll(LookupCurrency.class));
		request.setAttribute("empList", dbm.findAll(HrEmployee.class));

		forward(request, response, "Project/Project.jsp");
	}
}
